<?php

namespace App\Commands;

use App\Commands\Command;
use Illuminate\Contracts\Bus\SelfHandling;

use Session,Auth;
use App\Models\OperationLog;

class OperationLogCommand extends Command implements SelfHandling
{
    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct($operation_type,$operation_date,$operation_id)
    {
        $this->user = Auth::user();
        $this->operation_type = $operation_type;
        $this->operation_date = $operation_date;
        $this->operation_id = $operation_id;
    }

    /**
     * Execute the command.
     *
     * @return void
     */
    public function handle()
    {
        OperationLog::create(['user'=>$this->user->user_name,'operation_type'=>$this->operation_type,'operation_date'=>$this->operation_date,'operation_id'=>$this->operation_id,'time'=>date('Y-m-d H:i:s',time())]);

    }
}
